package com.yunxin.core.infra.persistence.mapper.channel;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.yunxin.core.infra.persistence.entity.channel.ChannelAdvanceChargeRecordDO;
import com.yunxin.core.infra.persistence.entity.channel.query.result.ChannelAdvanceChargeRecordStatisticsResult;
import com.yunxin.core.infra.persistence.entity.channel.query.result.ChannelAdvanceChargeResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * @author zero°
 * @since 2023-12-16
 */
@DS("core")
@Mapper
public interface ChannelAdvanceChargeRecordExtendMapper extends ChannelAdvanceChargeRecordMapper {

    /**
     * 分页查询渠道预付款记录列表总条数
     *
     * @param channelId              channelId
     * @param startAdvanceChargeDate startAdvanceChargeDate
     * @param endAdvanceChargeDate   endAdvanceChargeDate
     * @return long
     */
    long countChannelAdvanceChargeRecordPageQuery(@Param("channelId") Long channelId,
                                                  @Param("startAdvanceChargeDate") Date startAdvanceChargeDate,
                                                  @Param("endAdvanceChargeDate") Date endAdvanceChargeDate);
    long channelAdvanceChargeRecordSettlementNumberCount(@Param("channelId") Long channelId,
                                                  @Param("startAdvanceChargeDate") Date startAdvanceChargeDate,
                                                  @Param("endAdvanceChargeDate") Date endAdvanceChargeDate);

    /**
     * 分页查询渠道预付款记录列表
     *
     * @param channelId              channelId
     * @param startAdvanceChargeDate startAdvanceChargeDate
     * @param endAdvanceChargeDate   endAdvanceChargeDate
     * @param offset                 offset
     * @param pageSize               pageSize
     * @return List<ChannelAdvanceChargeRecordDO>
     */
    List<ChannelAdvanceChargeRecordDO> channelAdvanceChargeRecordPageQuery(@Param("channelId") Long channelId,
                                                                           @Param("startAdvanceChargeDate") Date startAdvanceChargeDate,
                                                                           @Param("endAdvanceChargeDate") Date endAdvanceChargeDate,
                                                                           @Param("offset") int offset,
                                                                           @Param("pageSize") int pageSize);
    /**
     * 查询渠道预付款记录统计
     *
     * @param channelId              channelId
     * @param startAdvanceChargeDate startAdvanceChargeDate
     * @param endAdvanceChargeDate   endAdvanceChargeDate
     * @return long
     */
    ChannelAdvanceChargeRecordStatisticsResult channelAdvanceChargeRecordStatistics(@Param("channelId") Long channelId,
                                                                                    @Param("startAdvanceChargeDate") Date startAdvanceChargeDate,
                                                                                    @Param("endAdvanceChargeDate") Date endAdvanceChargeDate);

    /**
     * 查询渠道预付款列表
     * @param channelIds channelIds
     * @return  List<ChannelAdvanceChargeResult>
     */
    List<ChannelAdvanceChargeResult> listChannelAdvanceChargeResultByChannelIds(@Param("channelIds") Set<Long> channelIds);
}
